package com.roncoo.pay.account.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.plugins.Page;
import com.roncoo.pay.account.entity.RpAccountHistory;
import com.roncoo.pay.account.mapper.RpAccountHistoryMapper;
import com.roncoo.pay.account.service.RpAccountHistoryService;
import com.roncoo.pay.common.core.page.PageBean;
import com.roncoo.pay.common.core.page.PageParam;

/**
 * 账户历史service实现类
 */
@Service("rpAccountHistoryService")
public class RpAccountHistoryServiceImpl implements RpAccountHistoryService{

	@Autowired
	private RpAccountHistoryMapper rpAccountHistoryMapper;
	
	@Override
	public void saveData(RpAccountHistory rpAccountHistory) {
		rpAccountHistoryMapper.insert(rpAccountHistory);
	}

	@Override
	public void updateData(RpAccountHistory rpAccountHistory) {
		rpAccountHistoryMapper.updateById(rpAccountHistory);
	}

	@Override
	public RpAccountHistory getDataById(String id) {
		return rpAccountHistoryMapper.selectById(id);
	}

	@Override
	public PageBean<RpAccountHistory> listPage(PageParam pageParam, RpAccountHistory rpAccountHistory) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("accountNo", rpAccountHistory.getAccountNo());
		Page<RpAccountHistory> page = new Page<RpAccountHistory>(pageParam.getPageNum(), pageParam.getNumPerPage());
		List<RpAccountHistory> list = rpAccountHistoryMapper.listPage(page , paramMap);
		PageBean<RpAccountHistory> pb = new PageBean<RpAccountHistory>(pageParam.getPageNum(), pageParam.getNumPerPage(), page.getTotal(),list);
		
		return pb;
	}
}